<?php

namespace App\B2BProject\Admin;

use Illuminate\Database\Eloquent\Model;

class AdminPanelNav extends Model
{
    protected $guarded = [];

    public function children()
    {
        return $this->hasMany('App\B2BProject\Admin\AdminPanelNav', 'parent_id', 'id');
    }

    public function hasChildren()
    {
        return $this->children->count() ? true : false;
    }

    public function parent()
    {
        return $this->belongsTo('App\B2BProject\Admin\AdminPanelNav', 'parent_id', 'id');
    }
}
